import plotly.express as px
import plotly
from PIL import Image
from matplotlib import pyplot as plt
# required for rndering correctrly on an HTML
# https://stackoverflow.com/a/58718006/
plotly.offline.init_notebook_mode()
# generate 100 random numbers for x and y
x = np.random.randn(1000)
y = np.random.randn(1000)
# if x is smaller than 0 make it red
# if x is larger than 0 make it blue
colors = ['red' if i < 0 else 'blue' for i in x]
# create a scatter plot
fig = px.scatter(x=x, y=y, color=colors)
# render the plot
plotly.offline.iplot(fig)